import socket

def check_telnet_connectivity(host, port=18001, timeout=5):
    try:
        sock = socket.create_connection((host, port), timeout)
        sock.close()
        print(f"{host} OK")
    except (socket.timeout, socket.error):
        print(f"{host} 异常")

if __name__ == "__main__":
    # 要检查的地址列表
    addresses = ['59.36.5.11', '112.93.132.11', ' 221.179.31.11']

    for address in addresses:
        check_telnet_connectivity(address)
